package Buffer2;

import java.util.Random;
import java.util.Scanner;

public class GuessNumber {
    public static void main(String[] args) {

    }

    public static  void start() {
        Random r = new Random();
        int number = r.nextInt(100);
        while (true) {
            Scanner sc = new Scanner(System.in);
            System.out.println("请输入你要猜的数字");
            int guessNumber = sc.nextInt();
            if (guessNumber < 0 | number > 100) {
                System.out.println("你输入的数字有误");
            } else if (guessNumber > number) {
                System.out.println("你猜的数字偏大");
            } else if (guessNumber < number) {
                System.out.println("你猜的数字偏小");
            } else {
                System.out.println("恭喜你猜中了");
                break;
            }

        }
    }
}
